home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7245 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: ufrima.imag.fr!usenet
  2. From: dardaine emmanuel <edardain>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: A simple "find the bug" (please! I need help :)
  5. Date: 22 Feb 1996 11:29:19 GMT
  6. Organization: UFRIMA, IMAG, Universite Joseph Fourier
  7. Message-ID: <4ghk2f$3e7@ufrima.imag.fr>
  8. References: <4gdr6n$6p0@guava.epix.net>
  9. NNTP-Posting-Host: boole.imag.fr
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (X11; I; SunOS 5.4 sun4m)
  14. X-URL: news://news-ufrima/4gdr6n$6p0@guava.epix.net
  15.  
  16. Hi,
  17.  
  18. I noticed a few mistakes in your program :
  19. - first, you add num2 to num1 before you get the values of these variables. You
  20. should do the sum after your cin statements,
  21. - you want to print the value of result with cout but result is declared in
  22. getnums (and so, only valid for this function). That's why the compiler doesn't
  23. know this variable. You should do the "cout<<result" statement in your getnums
  24. function, or declare result as a global variable (just like you did for num1
  25. and num2),
  26. - you also can do "cout << getnums ();"
  27.  
  28.  
  29.             Emmanuel
  30.  
  31.